/**
 * package-info.java com.mycompany.project.client.
 */
package com.mycompany.project.client.neville;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.mycompany.project.client.chee.ConfigurationGUI;

/**
 * Quality Check GUI Class.
 * 
 * @author Nick Neville, Chee Lee
 * @version 1.0.
 * 
 **/
public class QualityCheckGUI {

	/** VerticalPanel verticalPanel. */
	private final transient VerticalPanel verticalPanel = new VerticalPanel();

	/** TextArea txtrNewTextarea. */
	private final transient static ScrollPanel txtrNewTextarea = new ScrollPanel();

	/** TextArea txtrNewTextarea1. */
	private final transient static ScrollPanel txtrNewTextarea1 = new ScrollPanel();

	/** Button btnStartQualityCheck. */
	private final transient Button btnStartQualChk = new Button("Start Quality Check");

	/**
	 * getVerticalPanel() method.
	 * @return verticalPanel
	 */
	public final VerticalPanel getVerticalPanel() {
		return verticalPanel;
	}

	/**
	 * QualityCheckGUI() method.
	 * Set up the GUI for the QualityCheck interface.
	 */
	public QualityCheckGUI() {

		verticalPanel.setHorizontalAlign(HorizontalAlignment.CENTER);

		final HorizontalPanel horizontalPanel = new HorizontalPanel();
		horizontalPanel.setHorizontalAlign(HorizontalAlignment.CENTER);

		final HTML htmlConfiguration = 
				new HTML("Configuration 0", true);
		horizontalPanel.add(htmlConfiguration);
		htmlConfiguration.setWidth("120px");

		final HTML htmlConfig1 = new HTML("Configuration 1", true);
		horizontalPanel.add(htmlConfig1);
		htmlConfig1.setWidth("123px");
		verticalPanel.add(horizontalPanel);
		horizontalPanel.setSize("298px", "25px");

		final HorizontalPanel horizontalPanel1 = new HorizontalPanel();
		horizontalPanel1.setHorizontalAlign(HorizontalAlignment.CENTER);

		horizontalPanel1.add(txtrNewTextarea);
		txtrNewTextarea.setSize("160px", "140px");
		txtrNewTextarea.setStyleName("fontSize101");
		txtrNewTextarea1.setStyleName("fontSize101");
		horizontalPanel1.add(txtrNewTextarea1);
		txtrNewTextarea1.setSize("160px", "140px");
		verticalPanel.add(horizontalPanel1);
		horizontalPanel1.setSize("320px", "140px");
		btnStartQualChk.setWidth("232px");

		verticalPanel.setSize("299px", "200px");
		verticalPanel.add(btnStartQualChk);
		btnStartQualChk.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(final ClickEvent event) {
				ConfigurationGUI.updateGridList(0);
				ConfigurationGUI.updateGridList(1);
				txtrNewTextarea.clear();
				txtrNewTextarea1.clear();
				txtrNewTextarea.add(new HTML(QualityCheck.calculateConfigQuality(ConfigurationGUI.getHConfiguration(0))));
				txtrNewTextarea1.add(new HTML(QualityCheck.calculateConfigQuality(ConfigurationGUI.getHConfiguration(1))));
			}
		});
	}
	/**
	 * Gets the scrollPanel for quality check A.
	 * @return the ScrollPanel.
	 */
	public static ScrollPanel getTextA() {
		return txtrNewTextarea;
	}
	/**
	 * Gets the scrollPanel for quality check B.
	 * @return the ScrollPanel.
	 */
	public static ScrollPanel getTextB() {
		return txtrNewTextarea1;
	}
}
